package com.applcn.user.constant;

import com.baomidou.mybatisplus.core.enums.IEnum;

/**
 * com.applcn.user.constant
 * Description:
 *
 * @author: 大妖怪
 * @date: 2020-03-08 23:51
 */
public enum AuthRangeEnum implements IEnum<Integer> {

    /**
     * 运营
     */
    OPERATE(1, "运营"),

    /**
     * 商户
     */
    MERCHANT(2, "商户");

    private int code;

    private String desc;

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static AuthRangeEnum getAuthRange(Integer code){
        for (AuthRangeEnum authRangeEnum:AuthRangeEnum.values()) {
            if (authRangeEnum.getCode() == code) {
                return authRangeEnum;
            }
        }
        return null;
    }

    AuthRangeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.getCode();
    }
}
